#!/usr/bin/env bash

name=$1

PROCESS=`ps -ef|grep $1|grep -v grep|grep -v PPID|awk '{ print $2}'`
echo $PROCESS

for i in $PROCESS
do
  echo "Kill the $1 process [ $i ]"
  kill -9 $i
done

# 根据PID 杀死进程树 不是子线程
#pstree $1 -p | awk -F"[()]" '{for(i=0;i<=NF;i++)if($i~/[0-9]+/)print $i}' | xargs kill -9